home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / cmsnt100.zip / CMSNOTES.BAS next >
BASIC Source File  |  1992-07-23  |  18KB  |  707 lines

  1. ' Process CMS NOTEBOOK files
  2. '
  3. '   Allows reading of each note in file
  4. '   Allows replying to notes, regular mode
  5. '   Allows replying to notes, TEXT mode
  6. '   Allows sending notes
  7. '
  8.   DECLARE SUB AllDone ()
  9.   DECLARE SUB BuildIndex ()
  10.   DECLARE SUB HdrItems ()
  11.   DECLARE SUB HdrNote ()
  12.   DECLARE SUB HelpItems ()
  13.   DECLARE SUB HelpNote ()
  14.   DECLARE SUB Pause ()
  15.   DECLARE SUB ReadIndex ()
  16.   DECLARE SUB ReadNote (note)
  17.   DECLARE SUB SetUp ()
  18.   DECLARE SUB ShowFiles ()
  19.   DECLARE SUB ShowItems ()
  20.   DECLARE SUB ShowNote (note)
  21.   DECLARE SUB Display (file, pointer(), items%, first%, last%)
  22.  
  23.   DECLARE FUNCTION ConvertDate (adate$)
  24.   DECLARE FUNCTION Modtime$ (atime$)
  25.   DECLARE FUNCTION Word$ (aline$, num)
  26.  
  27.   COMMON SHARED dirnote$, dirndx$, indexsize%, notesize%
  28.   COMMON SHARED fsize, title$, version$, dircmd$
  29.   COMMON SHARED pitems(), pnote()
  30.   COMMON SHARED infile$, outfile$, note$(), note, notecount%
  31.  
  32.   title$ = "CMS Notebook processor "
  33.   version$ = "v1r0m0"
  34.  
  35.   PRINT ""
  36.   PRINT ""
  37.   PRINT title$ + version$
  38.  
  39.   SetUp
  40.   ShowFiles
  41.   ShowItems
  42.   AllDone
  43.  
  44.   END
  45.  
  46. '
  47. ' Close the .NOT and .IDX files
  48. '
  49. SUB AllDone
  50.   CLS
  51.   CLOSE #1
  52.   CLOSE #2
  53.   SHELL "del cmsnote.dir"
  54. END SUB
  55.  
  56. '
  57. ' Build an index of the selected .NOT file
  58. '
  59. SUB BuildIndex
  60.  
  61. '        12345678.123 nnnnnnnn  mm-dd-yy  hh:mm  nnnnnnn  nnnnnnn  nnn.nn%
  62.   PRINT "                                                                %";
  63.   LOCATE CSRLIN, 1
  64.   PRINT dirnote$;
  65. '        ....+....1....+....2....+....3....+....4....+....5....+....6....+....7
  66.   LINE INPUT #1, aline$
  67.   notecount% = 0
  68.   notestart = 1
  69.   lines = 0
  70.   OPEN outfile$ FOR OUTPUT AS #2
  71.   WRITE #2, "    0", 0, 0
  72.  
  73.   DO
  74.     lines = lines + 1
  75.  
  76.     IF LEFT$(aline$, 72) = STRING$(72, "=") THEN
  77.        IF notecount% > 0 THEN
  78.           notelines% = notelines% - 1
  79.           size$ = RIGHT$("     " + STR$(notelines%), 5)
  80.           item$ = from$ + " " + ndate$ + " " + size$ + " " + subj$
  81.           FOR z = 1 TO LEN(item$)
  82.               IF MID$(item$, z, 1) = CHR$(34) THEN
  83.                  MID$(item$, z, 1) = "'"
  84.               END IF
  85.           NEXT z
  86.           WRITE #2, item$, notestart, notelines%
  87.        END IF
  88.  
  89.        needhdr$ = "Y"
  90.        notelines% = 0
  91.        notecount% = notecount% + 1
  92.        LOCATE CSRLIN, 41
  93.        PRINT RIGHT$("       " + STR$(notecount%), 7);
  94.        LOCATE CSRLIN, 50
  95.        PRINT RIGHT$("       " + STR$(lines), 7);
  96.        LOCATE CSRLIN, 59
  97.        PRINT USING "###.##%"; (notestart / fsize) * 100;
  98.  
  99.        notestart = SEEK(1)
  100.     ELSE
  101.  
  102.       IF needhdr$ = "Y" THEN
  103.          Work$ = Word$(UCASE$(aline$), 1)
  104.          SELECT CASE Work$
  105.  
  106.             CASE "FROM:"
  107.                from$ = LTRIM$(MID$(aline$, 7))
  108.                from$ = LEFT$(from$ + SPACE$(19), 19)
  109.  
  110.             CASE "DATE:"
  111.                ndate$ = LTRIM$(MID$(aline$, 7))
  112.                ndate$ = LEFT$(ndate$ + SPACE$(14), 14)
  113.  
  114.             CASE "SUBJECT:"
  115.                subj$ = LTRIM$(MID$(aline$, 10))
  116.  
  117.             CASE ""
  118.                needhdr$ = "N"
  119.  
  120.          END SELECT
  121.       END IF
  122.     END IF
  123.     notelines% = notelines% + 1
  124.     LINE INPUT #1, aline$
  125.   LOOP WHILE NOT (EOF(1))
  126.  
  127.   LOCATE CSRLIN, 41
  128.   PRINT RIGHT$("       " + STR$(notecount%), 7);
  129.   LOCATE CSRLIN, 50
  130.   PRINT RIGHT$("       " + STR$(lines), 7);
  131.   LOCATE CSRLIN, 59
  132.   PRINT "100.00%"
  133.  
  134.   notelines% = notelines% - 1
  135.   size$ = RIGHT$("     " + STR$(notelines%), 5)
  136.   item$ = from$ + " " + ndate$ + " " + size$ + " " + subj$
  137.   FOR z = 1 TO LEN(item$)
  138.       IF MID$(item$, z, 1) = CHR$(34) THEN
  139.          MID$(item$, z, 1) = "'"
  140.       END IF
  141.   NEXT z
  142.   WRITE #2, item$, notestart, notelines%
  143.   SEEK #2, 1
  144.   WRITE #2, LEFT$(STR$(notecount%) + SPACE$(5), 5), 0, 0
  145.   CLOSE #2
  146.  
  147. END SUB
  148.  
  149. '
  150. ' To convert a date string of mm/dd/yy into a numeric of yymmdd
  151. '
  152. FUNCTION ConvertDate (adate$)
  153.   adate$ = RIGHT$("0" + adate$, 8)
  154.   am$ = LEFT$(adate$, 2)
  155.   ad$ = MID$(adate$, 4, 2)
  156.   ay$ = RIGHT$(adate$, 2)
  157.   ConvertDate = VAL(ay$ + am$ + ad$)
  158. END FUNCTION
  159.  
  160. '
  161. ' to display either a item or note screen
  162. '
  163. SUB Display (file, pointer(), items%, first%, last%)
  164. '   LOCATE 2, 1
  165. '   PRINT file, pointer(first%), items%, first%, last%
  166.     IF file = 1 THEN
  167.        LOCATE 3, 1
  168.     ELSE
  169.        LOCATE 4, 1
  170.     END IF
  171.     FOR z% = first% TO last%
  172.         IF z% > items% THEN
  173.            EXIT FOR
  174.         END IF
  175.         SEEK file, pointer(z%)
  176.         IF file = 1 THEN
  177.            LINE INPUT #file, line$
  178.            PRINT LEFT$(line$ + SPACE$(80), 80)
  179.         ELSE
  180.            INPUT #file, items$, start, lines%
  181.            PRINT RIGHT$(SPACE$(5) + STR$(z%), 5) + " " + LEFT$(items$ + SPACE$(33), 73)
  182.         END IF
  183.     NEXT z%
  184.     DO WHILE CSRLIN < 24
  185.        PRINT SPACE$(80)
  186.     LOOP
  187.  
  188. END SUB
  189.  
  190. '
  191. ' Print headers for ShowItems
  192. '
  193. SUB HdrItems
  194.     CLS
  195.     PRINT title$ + version$
  196.     LOCATE 1, 40
  197.     PRINT infile$
  198.     LOCATE 1, 67
  199.     PRINT "Items: " + STR$(notecount%)
  200.  
  201.     LOCATE 3, 1
  202.     PRINT "    # From:               Date:          Size: Subject:"
  203. '   PRINT "1234 1234567890123456789 12345678901234 1234 12345678901234567890123456789"
  204.  
  205.     LOCATE 24, 1
  206.     PRINT "Up & Down arrow keys, PgUp & PgDn";
  207.     LOCATE 24, 40
  208.     PRINT "Bottom   Help   Quit   Read   Top";
  209. END SUB
  210.  
  211. '
  212. ' Print headers for ReadNote
  213. '
  214. SUB HdrNote
  215.     CLS
  216.     PRINT title$ + version$
  217.     LOCATE 1, 40
  218.     PRINT "Note: " + STR$(note)
  219.     LOCATE 1, 67
  220.     PRINT "Lines: " + STR$(notesize%)
  221.  
  222.     LOCATE 24, 1
  223.     PRINT "Up & Down arrow keys, PgUp & PgDn";
  224.     LOCATE 24, 40
  225.     PRINT "Bottom   Help   Next   Prev   Quit   Top";
  226. END SUB
  227.  
  228. '
  229. ' Give help for the Items screen
  230. '
  231. SUB HelpItems
  232.   CLS
  233.   PRINT "Help for items screen"
  234.   PRINT ""
  235.   PRINT "Here is where you view the index of notes"
  236.   PRINT ""
  237.   PRINT "You can scroll through the list with the arrow keys and the"
  238.   PRINT "PageUp and PageDown keys"
  239.   PRINT ""
  240.   PRINT "You read a note with the R key and leave this program with Q"
  241.   DO
  242.   LOOP WHILE INKEY$ = ""
  243. END SUB
  244.  
  245. '
  246. ' Give help for the Items screen
  247. '
  248. SUB HelpNote
  249.   CLS
  250.   PRINT "Help for note screen"
  251.   PRINT ""
  252.   PRINT "Here is where you view the note"
  253.   PRINT ""
  254.   PRINT "You can scroll through the note with the arrow keys and the"
  255.   PRINT "PageUp and PageDown keys"
  256.   PRINT ""
  257.   PRINT "You read the next note with the N key, see the previous with P"
  258.   PRINT "and leave this program with Q"
  259.   DO
  260.   LOOP WHILE INKEY$ = ""
  261. END SUB
  262.  
  263. '
  264. ' to take a hh:mmx time and return a 24 hour time as hh:mm
  265. '
  266. FUNCTION Modtime$ (atime$)
  267.     ind$ = RIGHT$(atime$, 1)
  268.     IF ind$ = "P" THEN
  269.        IF LEFT$(atime$, 2) <> "12" THEN
  270.           MID$(atime$, 1, 2) = LTRIM$(STR$(VAL(LEFT$(atime$, 2)) + 12))
  271.        END IF
  272.     END IF
  273.     IF ind$ = "P" OR ind$ = "A" THEN
  274.        atime$ = LEFT$(atime$, LEN(atime$) - 1)
  275.     END IF
  276.     Modtime$ = RIGHT$(atime$, 5)
  277. END FUNCTION
  278.  
  279. '
  280. ' to pause the display
  281. '
  282. SUB Pause
  283.   PRINT ""
  284.   PRINT ""
  285.   PRINT "Press a key to continue"
  286.   DO
  287.   LOOP UNTIL INKEY$ <> ""
  288. END SUB
  289.  
  290. '
  291. ' To read in an existing .NDX file
  292. '
  293. SUB ReadIndex
  294.  
  295. '        12345678.123 nnnnnnnn  mm-dd-yy  hh:mm  nnnnnnn  nnnnnnn  nnn.nn%
  296.   PRINT "                                                                 ";
  297.   LOCATE CSRLIN, 1
  298.   PRINT dirndx$;
  299. '        ....+....1....+....2....+....3....+....4....+....5....+....6....+....7
  300.   OPEN outfile$ FOR INPUT AS #2
  301.   INPUT #2, size$, start, lines
  302.  
  303.   size% = VAL(size$)
  304.  
  305.   DIM pitems(size%)
  306.  
  307.   lines = 0
  308.   FOR z% = 1 TO size%
  309.       pitems(z%) = SEEK(2)
  310.       INPUT #2, items$, start, lines%
  311.  
  312.       lines = lines + lines% + 1
  313.       LOCATE CSRLIN, 41
  314.       PRINT RIGHT$("       " + STR$(z%), 7);
  315.       LOCATE CSRLIN, 50
  316.       PRINT RIGHT$("       " + STR$(lines), 7);
  317.       LOCATE CSRLIN, 59
  318.       PRINT USING "###.##%"; (z% / size%) * 100;
  319.  
  320.       IF EOF(2) THEN
  321.          EXIT FOR
  322.       END IF
  323.  
  324.   NEXT z%
  325.  
  326.   LOCATE CSRLIN, 41
  327.   PRINT RIGHT$("       " + STR$(z%), 7);
  328.   LOCATE CSRLIN, 50
  329.   PRINT RIGHT$("       " + STR$(lines), 7);
  330.   LOCATE CSRLIN, 59
  331.   PRINT "100.00%"
  332.  
  333.   notecount% = z%
  334.   indexsize% = size%
  335.  
  336. END SUB
  337.  
  338. '
  339. ' Read the note selected
  340. '
  341. SUB ReadNote (note)
  342.   LOCATE 2, 1
  343.   PRINT "Reading note " + STR$(note);
  344.   SEEK #2, pitems(note)
  345.   INPUT #2, items$, start, lines%
  346.   ERASE pnote
  347.   DIM pnote(lines%)
  348.   SEEK #1, start
  349.   FOR z% = 1 TO lines%
  350.       pnote(z%) = SEEK(1)
  351.       LINE INPUT #1, aline$
  352.   NEXT z%
  353.   notesize% = lines%
  354. END SUB
  355.  
  356. '
  357. ' Clear screen and other house keeping
  358. '
  359. SUB SetUp
  360.     dircmd$ = "DIR"
  361.     IF INSTR(ENVIRON$("COMSPEC"), "4DOS") <> 0 THEN
  362.        dircmd$ = "DIR /J"
  363.     END IF
  364. END SUB
  365.  
  366. '
  367. ' Show all the .NOT files in the current directory
  368. ' Allow user to select the one they want
  369. ' Open that file as file #1
  370. '
  371. SUB ShowFiles
  372.   PRINT "": PRINT "":
  373.   INPUT "What is the name of the file? ", infile$
  374.   infile$ = UCASE$(infile$)
  375.  
  376. ' get the path of the file
  377.   dot = 0
  378.   FOR z = LEN(infile$) TO 1 STEP -1
  379.       IF MID$(infile$, z, 1) = "\" THEN
  380.          slash = z
  381.          EXIT FOR
  382.       END IF
  383.       IF MID$(infile$, z, 1) = "." THEN
  384.          dot = z
  385.       END IF
  386.   NEXT z
  387.  
  388.   IF dot = 0 THEN
  389.      dot = LEN(infile$)
  390.      iext$ = ""
  391.   ELSE
  392.      iext$ = MID$(infile$, dot + 1)
  393.   END IF
  394.  
  395.   path$ = LEFT$(infile$, slash)
  396.   iname$ = MID$(infile$, slash + 1, dot - slash - 1)
  397.  
  398.   outfile$ = path$ + iname$ + ".NDX"
  399.  
  400. ' see if it exists
  401.   SHELL dircmd$ + " " + path$ + iname$ + ".* > cmsnote.dir"
  402.  
  403.   OPEN "CMSNOTE.DIR" FOR INPUT AS #1
  404.   ndate$ = "00-00-00"
  405.   ntime$ = "00:00"
  406.   DO
  407.      LINE INPUT #1, aline$
  408.      aline$ = UCASE$(aline$)
  409.  
  410.     IF Word$(aline$, 1) = iname$ THEN
  411.        IF Word$(aline$, 2) = iext$ THEN
  412.           dirnote$ = aline$
  413.           fsize = VAL(Word$(aline$, 3))
  414.           fdate$ = Word$(aline$, 4)
  415.           ftime$ = Modtime$("0" + Word$(aline$, 5))
  416.        END IF
  417.     END IF
  418.  
  419.     IF Word$(aline$, 1) = iname$ THEN
  420.        IF Word$(aline$, 2) = "NDX" THEN
  421.           dirndx$ = aline$
  422.           ndate$ = Word$(aline$, 4)
  423.           ntime$ = Modtime$("0" + Word$(aline$, 5))
  424.        END IF
  425.     END IF
  426.   LOOP UNTIL EOF(1)
  427.  
  428.   CLOSE 1
  429.   IF fdate$ = "" THEN
  430.      IF ndate$ = "" THEN
  431.         PRINT "weird error, found no dates for input file or index file"
  432.         END
  433.      END IF
  434.   END IF
  435.   OPEN infile$ FOR INPUT AS #1
  436.  
  437.   ndate = ConvertDate(ndate$)
  438.   fdate = ConvertDate(fdate$)
  439.  
  440. '  PRINT fdate$, ftime$, ndate$, ntime$
  441. '  PRINT fdate, ndate
  442. '  PRINT " "
  443.  
  444.   PRINT "Fileid        Size:     Date:    Time:  Notes:   Lines:   Done:"
  445.  
  446.   IF fdate >= ndate THEN
  447.      IF fdate = ndate THEN
  448.         IF ftime$ > ntime$ THEN
  449.            BuildIndex
  450.            dirndx$ = nfile$
  451.         ELSE
  452.            PRINT dirnote$
  453.         END IF
  454.      ELSE
  455.         BuildIndex
  456.         dirndx$ = nfile$
  457.      END IF
  458.   ELSE
  459.      PRINT dirnote$
  460.   END IF
  461.  
  462.   ReadIndex
  463.   Pause
  464.  
  465. END SUB
  466.  
  467. '
  468. ' Show the .IDX of the .NOT file previously selected
  469. '
  470. SUB ShowItems
  471.  
  472.     nextline% = 1
  473.     increment% = 19
  474.     IF notecount% < increment% THEN
  475.        increment% = notecount%
  476.     END IF
  477.     lastline% = nextline% + increment%
  478.     row = 4
  479.     HdrItems
  480.     CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  481.     DO
  482.        LOCATE row, 1
  483.        PRINT CHR$(16)
  484.        DO
  485.           key$ = INKEY$
  486.        LOOP WHILE key$ = ""
  487.  
  488.        SELECT CASE key$
  489.           CASE CHR$(27)
  490.             key$ = "Q"
  491.  
  492.           CASE CHR$(0) + "H" ' Up arrow
  493.             LOCATE row, 1
  494.             PRINT " "
  495.             row = row - 1
  496.             IF row < 4 THEN
  497.                row = 4
  498.             nextline% = nextline% - 1
  499.             IF nextline% < 1 THEN
  500.                nextline% = 1
  501.             END IF
  502.             lastline% = nextline% + increment%
  503.             CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  504.             END IF
  505.  
  506.           CASE CHR$(0) + "P" ' Down arrow
  507.             LOCATE row, 1
  508.             PRINT " "
  509.             row = row + 1
  510.             IF row > 23 THEN
  511.                row = 23
  512.                nextline% = nextline% + 1
  513.                IF nextline% > notecount% THEN
  514.                   nextline% = nextline% - 1
  515.                END IF
  516.                lastline% = nextline% + increment%
  517.                CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  518.             ELSE
  519.                IF CHR$(SCREEN(row, 5)) = " " THEN
  520.                   row = row - 1
  521.                END IF
  522.             END IF
  523.  
  524.           CASE CHR$(0) + "I" ' Page Up
  525.             LOCATE row, 1
  526.             PRINT " "
  527.             row = 4
  528.             nextline% = nextline% - increment%
  529.             IF nextline% < 1 THEN
  530.                nextline% = 1
  531.             END IF
  532.             lastline% = nextline% + increment%
  533.             CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  534.  
  535.           CASE CHR$(0) + "Q" ' Page Down
  536.             LOCATE row, 1
  537.             PRINT " "
  538.             row = 4
  539.             nextline% = nextline% + increment%
  540.             IF nextline% > notecount% THEN
  541.                nextline% = nextline% - increment%
  542.             END IF
  543.             lastline% = nextline% + increment%
  544.             CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  545.  
  546.           CASE "b", "B"
  547.              lastline% = notecount%
  548.              nextline% = lastline% - increment%
  549.              IF nextline% < 1 THEN
  550.                 nextline% = 1
  551.              END IF
  552.              CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  553.  
  554.           CASE "h", "H"
  555.              CALL HelpItems
  556.              HdrItems
  557.              CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  558.  
  559.           CASE "r", "R"
  560.              note$ = ""
  561.              FOR z = 2 TO 5
  562.                  note$ = note$ + CHR$(SCREEN(row, z))
  563.              NEXT z
  564.              note = VAL(LTRIM$(note$))
  565.              CALL ShowNote(note)         ' Read the note
  566.              HdrItems
  567.              CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  568.  
  569.           CASE "t", "T"
  570.              nextline% = 1
  571.              lastline% = nextline% + increment%
  572.              CALL Display(2, pitems(), indexsize%, nextline%, lastline%)
  573.  
  574.        END SELECT
  575.  
  576.     LOOP WHILE UCASE$(key$) <> "Q"
  577.  
  578. END SUB
  579.  
  580. '
  581. ' Show the note selected
  582. '
  583. SUB ShowNote (note)
  584.   DO
  585.     CALL ReadNote(note)
  586.     nextnote = 0
  587.     nextline% = 1
  588.     increment% = 20
  589.     IF notesize% < increment% THEN
  590.        increment% = notesize%
  591.     END IF
  592.     lastline% = nextline% + increment%
  593.     row = 3
  594.     HdrNote
  595.     CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  596.  
  597.     DO
  598.        LOCATE row, 1
  599.        DO
  600.           key$ = INKEY$
  601.        LOOP WHILE key$ = ""
  602.  
  603.        SELECT CASE key$
  604.           CASE CHR$(27)
  605.             key$ = "Q"
  606.  
  607.           CASE CHR$(0) + "H" ' Up arrow
  608.             nextline% = nextline% - 1
  609.             IF nextline% < 1 THEN
  610.                nextline% = 1
  611.             END IF
  612.             lastline% = nextline% + increment%
  613.             CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  614.  
  615.           CASE CHR$(0) + "P" ' Down arrow
  616.             nextline% = nextline% + 1
  617.             IF nextline% > notesize% THEN
  618.                nextline% = nextline% - 1
  619.             END IF
  620.             lastline% = nextline% + increment%
  621.             CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  622.  
  623.           CASE CHR$(0) + "I" ' Page Up
  624.             nextline% = nextline% - increment%
  625.             IF nextline% < 1 THEN
  626.                nextline% = 1
  627.             END IF
  628.             lastline% = nextline% + increment%
  629.             CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  630.  
  631.           CASE CHR$(0) + "Q" ' Page Down
  632.             nextline% = nextline% + increment%
  633.             IF nextline% > notesize% THEN
  634.                nextline% = nextline% - increment%
  635.             END IF
  636.             lastline% = nextline% + increment%
  637.             CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  638.  
  639.           CASE "b", "B"
  640.              lastline% = notesize%
  641.              nextline% = lastline% - increment%
  642.              IF nextline% < 1 THEN
  643.                 nextline% = 1
  644.              END IF
  645.              CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  646.  
  647.           CASE "h", "H"
  648.             CALL HelpNote
  649.             HdrNote
  650.             CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  651.  
  652.           CASE "n", "N"
  653.             nextnote = 1                   ' Want next note
  654.             key$ = "Q"
  655.             note = note + 1            ' Want next note
  656.             IF note > notecount% THEN
  657.                note = note - 1
  658.                nextnote = 0                ' want to exit readnote
  659.             END IF
  660.  
  661.           CASE "p", "P"
  662.             nextnote = 1                   ' Want next note
  663.             key$ = "Q"
  664.             note = note - 1            ' Want next note
  665.             IF note < 1 THEN
  666.                note = note + 1
  667.                nextnote = 0                ' Want to exit readnote
  668.             END IF
  669.  
  670.           CASE "t", "T"
  671.              nextline% = 1
  672.              lastline% = nextline% + increment%
  673.              CALL Display(1, pnote(), notesize%, nextline%, lastline%)
  674.  
  675.        END SELECT
  676.  
  677.     LOOP WHILE UCASE$(key$) <> "Q"
  678.   LOOP WHILE nextnote = 1
  679. END SUB
  680.  
  681. '
  682. ' To return any blank delimited word from a string
  683. '
  684. FUNCTION Word$ (aline$, num)
  685.   Work$ = ""
  686.   wordnum = 0
  687.   aline$ = LTRIM$(aline$)
  688.   FOR z = 1 TO LEN(aline$)
  689.       achar$ = MID$(aline$, z, 1)
  690.       IF achar$ = " " THEN
  691.          IF Work$ > "" THEN
  692.             wordnum = wordnum + 1
  693.             IF wordnum = num THEN
  694.                EXIT FOR
  695.             ELSE
  696.                Work$ = ""
  697.             END IF
  698.          END IF
  699.       ELSE
  700.          Work$ = Work$ + achar$
  701.       END IF
  702.   NEXT z
  703.  
  704.   Word$ = Work$
  705. END FUNCTION
  706.  
  707.